home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 685 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: harden.demon.co.uk!mark
  2. From: Mark Harden <mark@harden.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Binary Tree and MSC/C++7.00
  5. Date: Mon, 8 Jan 1996 15:48:38 +0000
  6. Organization: Not an organisation
  7. Distribution: world
  8. Message-ID: <1s+9WFAWzT8wEwN7@harden.demon.co.uk>
  9. References: <HAKOLA.96Jan7002825@lk-hp-16.hut.fi>
  10. Reply-To: Mark Harden <mharden@harden.demon.co.uk>
  11. NNTP-Posting-Host: harden.demon.co.uk
  12. X-NNTP-Posting-Host: harden.demon.co.uk
  13. MIME-Version: 1.0
  14. X-Newsreader: Turnpike Version 1.10 <RMdKwNiDEBO6d87vIffee+0s$n>
  15.  
  16. In article <HAKOLA.96Jan7002825@lk-hp-16.hut.fi>, Petri Hakola
  17. <hakola@snakemail.hut.fi> writes
  18.  
  19. Hi
  20.  
  21. >               if(root == NULL)
  22. >                  return;
  23. >                delete_tree(root->left);
  24. >                  free(root);
  25. >               delete_tree(root->right);
  26.  
  27. Swap the last two line you cannot access root after it is freed !
  28.  
  29. >       And then some problems with strings. Is it common that while
  30. >       coding using Microsoft Programmers Workbench, strings aren't
  31. >       what they're supposed to be. For examble, if I use strncat to
  32. >       cut string from 100 char to 45 char, string is cut, but if I
  33. >       print it using printf, first 45 chars come out ok, but rest of
  34. >       the string is filled with smiling faces and all sorts of
  35. >       'exotic' characters. Like '\0' isn't there or something...
  36.  
  37. strncat doesn't always append a '\0' character.  Do it yourself with
  38. string [45] = '\0' and read up on strncat.
  39.  
  40. >       Any suggestions are very welcome, I'm quite stuck with these
  41. >       problems of mine.
  42.  
  43. No problem I hope I helped !
  44.  
  45. >                                                       - Petri -
  46.  
  47. -- 
  48. Mark Harden
  49.